Ext.define('PJ.view.indexremind.IndexList', {
    extend: 'AM.default.DefaultList',
    selModel: {
    },
	alias: 'widget.indexList',
    requires: ['AM.default.DefaultSearchForm',
               'AM.default.DateTime', 
               'AM.default.DefaultDateField',
               'AM.default.DefaultDoubleDateField',
               'AM.default.jsonp.DefaultLoadJsonp',//jsonp加载数据
		       'AM.default.DefaultActiveStateCombo'
               ],
    initComponent: function(){
    	this.columns = [{
        	header: '学员帐号',
        	dataIndex: 'bu.login_id',
        	width: 70
        },{
        	header: '姓名',
        	dataIndex: 'bu.user_name',
        	width: 70,
    		renderer: function(value, metaData, record){
    			metaData.tdAttr = 'data-qtip="' + value + '"';
    			return value;
    		}
        }, {
            header: '单位',
            dataIndex: 'bd.depname',
            flex:1,
            minWidth: 140,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '职级',
            dataIndex: 'bu.duty_Level_Code',
            flex:1,
            minWidth: 155,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '中组部调训',
            dataIndex: 'uct.zhongydx_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '主体班',
            dataIndex: 'uct.zhutb_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '境外培训',
            dataIndex: 'uct.jwpx_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '专题班',
            dataIndex: 'uct.ztb_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '其他',
            dataIndex: 'uct.qit_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '在线学时',
            dataIndex: 'uct.zx_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '在线折算学时',
            dataIndex: 'uct.zxZs_Hour',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + value + '"';
                return value;
            }
        },{
            header: '合计',
            dataIndex: 'uct.hours',
            flex:0.5,
            renderer: function(value, meta, record){
                meta.tdAttr = 'data-qtip="' + record.get("hourYear") + '年"';
                if (record.get("isStandard") == 1)
    				meta.style = "white-space:normal;cursor: pointer;color:blue;";
                else if (record.get("isStandard") == 2)
    				meta.style = "white-space:normal;cursor: pointer;color:red;";
                return value;
            }
        }];
      this.store = Ext.create('PJ.'+ prototype +'.trainingmanagement.AuditUserList');
      this.callParent(arguments);
      this.loadType = gj_onlineLearning_constant.loadType;//加载方式
   	},
   	/**
  	 * 导出学员学习记录
  	 */
  	onExportUserRecordClick:function(){
  	  var me=this;
  	  var depid=me.up("container").depid;
  	  var store=me.getStore();
      	href=store.exportUnqualifiedUserListExcel + "?isStandard=2&searchDepId="+depid;
      	if(this.grid.isPromoteStandard){
      		href+="&isPromoteStandard="+this.grid.isPromoteStandard;
      	}
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
	},
    listeners: {
//    	selectionchange: function(selModel, selected){
//    		this.down('#' + this.oldId + 'Export').setDisabled(selected.length === 0);
//    	},
    	viewready: function(){
  			var me = this;
  			//导出按钮集合
  			this.addDocked([{
  				dock: 'top',
  				xtype: "searchform",
  				columnCount: 3,
                fieldDefaults: {
                    xtype: "combo",
                    emptyText: "请选择",
                    editable: false,
                    queryMode: 'local',//'remote',//数据类型
                    valueField: 'value',
                    displayField: 'text',
                    
                    labelAlign: 'right',
                    labelWidth: 100,
                    maxLength: 100
                },
  				items: [{
                    xtype: "textfield",
                    name: "searchLoginID",
        			columnWidth: .33,
    				labelAlign: 'right',
                    emptyText: '请输入学员账号',
                    fieldLabel: '账号'
                },{
                    xtype: "textfield",
                    name: "searchUserName",
        			columnWidth: .33,
    				labelAlign: 'right',
                    emptyText: '请输入姓名',
                    fieldLabel: '姓名'
                },{
                    xtype: "textfield",
                    name: "searchDeptName",
                    columnWidth:.34,
    				labelAlign: 'right',
                    emptyText: '请输入部门名称',
                    fieldLabel: '部门名称'
                },{
                    fieldLabel: "年份",
                    emptyText: '请选择',
                    value:2017,
        			columnWidth: .33,
                    name: "searchYear",
                    store: Ext.create("Ext.data.ArrayStore", {
    					fields: ['value', 'text'],
    					data: [[2012, '2012'], [2013, '2013'], [2014, '2014'], [2015, '2015'], [2016, '2016'], [2017, '2017'], [-1, '不限']]
    				})
                }, {
                	fieldLabel: "职级",
                    name: "dutyLevelId",
                    emptyText: '请选择',
        			columnWidth: .33,
                    labelAlign: 'right',
                    store: Ext.create("Ext.data.ArrayStore", {
    					fields: ['value','text'],
    					data: [['1380', '厅局级正职（巡视员）'], ['1381', '厅局级副职（副巡视员）'], ['1382', '县处级正职（调研员）'],['1383','县处级副职（副调研员）'],['1384','乡科级副职（副主任科员）'],['1385','乡科级副职（副主任科员）'],['1386','科员'],['1387','办事员'],['1388','退休'],['1424','未定职公务员']]
    				}),
                    emptyText: "请选择"
                }, {
                	fieldLabel: "是否达标",
                    name: "isStandard",
                    emptyText: '请选择',
                    value:'未达标',
        			columnWidth: .34,
                    labelAlign: 'right',
                    store: Ext.create("Ext.data.ArrayStore", {
    					fields: ['value','text'],
    					data: [['1', '达标'], ['', '未达标']]
    				}),
                    columnWidth:.34,
                    emptyText: "请选择"
                }],
  				grid: this
  			},{
  				xtype: 'toolbar',
  				dock: 'top',
  				displayInfo: true,
  				items: [/*this.addButton, "-", this.updateButton, "-", */
				     /* {
                      text: '查看详情',
                      iconCls: 'applicationAuditIco',
                      itemId: this.oldId + "ApplicationAudit",
                      disabled: true,
                      scope: this,
                      handler: this.onApplicationAuditClick
                  },"-",*/{
                	  text: '导出未达标学员',
                      iconCls: 'deriveIco',
                      itemId: this.oldId + "Export",
                      disabled: false,
                      scope: this,
                      handler: this.onExportUserRecordClick
                  }/*,"->", this.countSelectPanel*/]
  			}]);
    		// 触发权限过滤事件
    		this.fireEvent("permission", this);
    		var params = this.store.proxy.extraParams;
    		var newParams = {
    				isStandard:this.grid.isStandard,
    				isPromoteStandard:this.grid.isPromoteStandard
    		};
    		Ext.apply(params, newParams);
    		this.store.isLoad = true;
    		this.store.load();
  		}
    }
});
